/*
 * Copyright (c) 2013 iTAC Software AG, Germany. All Rights Reserved.
 * 
 * This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
 * printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
 * without the written permission of iTAC Software AG.
 */
package org.template.portal;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

// TODO
/**
 * @author rafal.kojta
 */
@Entity
@Table(name = "post")
public class Post {

  @Id
  @GeneratedValue(strategy = IDENTITY)
  @Column(name = "POST_ID", unique = true, nullable = false)
  private long postId;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "GROUP_ID")
  private YearGroup yearGroup;

  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "STUDENT_ID")
  private Student student;// author

  @OneToMany(fetch = FetchType.LAZY, mappedBy = "post")
  private Set<Reply> replies;

  @Column(name = "DATE")
  private Date date;

  @Column(name = "TITLE")
  private String title;

  @Column(name = "CONTENT")
  private String content;

  public Post() {

  }

  public long getPostId() {
    return postId;
  }

  public void setPostId(long postId) {
    this.postId = postId;
  }

  public YearGroup getYearGroup() {
    return yearGroup;
  }

  public void setYearGroup(YearGroup group) {
    this.yearGroup = group;
  }

  public Student getStudent() {
    return student;
  }

  public void setStudent(Student student) {
    this.student = student;
  }

  public Date getDate() {
    return date;
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getContent() {
    return content;
  }

  public void setContent(String content) {
    this.content = content;
  }

  public Set<Reply> getReplies() {
    return replies;
  }

  public void setReplies(Set<Reply> replies) {
    this.replies = replies;
  }

}
